//
//  UIImage.swift
//  CMKit
//
//  Created by travel on 2016/12/16.
//  Copyright © 2016年 covermedia. All rights reserved.
//

import UIKit


public extension UIImage {
    
    /// 返回指定颜色和大小的图片
    ///
    /// - Parameters:
    ///   - color: 图片颜色
    ///   - size: 图片大小
    /// - Returns: 图片
    public class func imageWith(color: UIColor, size: CGSize) -> UIImage {
        let rect = CGRect.init(origin: CGPoint.zero, size: size)
        UIGraphicsBeginImageContextWithOptions(size, false, 0)
        color.setFill()
        UIRectFill(rect)
        let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
        UIGraphicsEndImageContext()
        return image
    }
}
